import api from "@/api";
import { PORT } from "../config/servicePort";

/**
 * 获取折扣列表
 */
export const getDiscountList = (params: any) => api.get(`${PORT}/DiscountCodes/getList`, params);

// 导出一个函数createDiscount，用于创建折扣码
export const createDiscount = (data?: any) => api.post(`${PORT}/DiscountCodes/add`, data);

// 优惠码失效
export const suspendDiscount = (data?: any) => api.post(`${PORT}/DiscountCodes/pause`, data);

// 删除优惠券
export const deleteDiscount = (data?: any) => api.post(`${PORT}/DiscountCodes/del`, data);

// 获取优惠券详情
export const getDiscountDetail = (data?: any) => api.post(`${PORT}/DiscountCodes/detail`, data);

//获取优惠码使用记录列表
export const getDiscountUseRecords = (params: any) => api.get(`${PORT}/UserUseDiscountCodeLog/getList`, params);

//删除优惠码使用记录
export const deleteDiscountRecord = (data?: any) => api.post(`${PORT}/UserUseDiscountCodeLog/del`, data);
